<!DOCTYPE html>
<html lang="zh" dir="ltr" class="client-nojs">
<head>
<title>std::basic_filebuf</title>
<meta charset="UTF-8">
<meta name="generator" content="MediaWiki 1.21.2">
<link rel="shortcut icon" href="../../../common/favicon.ico">
<link rel="stylesheet" href="../../../common/ext.css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" href="../../../common/site_modules.css">
<style>a:lang(ar),a:lang(ckb),a:lang(fa),a:lang(kk-arab),a:lang(mzn),a:lang(ps),a:lang(ur){text-decoration:none}#toc{display:none}.editsection{display:none}
/* cache key: mwiki1-mwiki_zh_:resourceloader:filter:minify-css:7:15cea3ec788a65b5187d4018eed543bf */</style>

<script src="../../../common/startup_scripts.js"></script>
<script>if(window.mw){
mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"cpp/io/basic_filebuf","wgTitle":"cpp/io/basic filebuf","wgCurRevisionId":46607,"wgArticleId":2188,"wgIsArticle":true,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":[],"wgBreakFrames":false,"wgPageContentLanguage":"zh","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"zh","wgMonthNames":["","1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"wgMonthNamesShort":["","1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"wgRelevantPageName":"cpp/io/basic_filebuf","wgUserVariant":"zh","wgRestrictionEdit":[],"wgRestrictionMove":[]});
}</script><script>if(window.mw){
mw.loader.implement("user.options",function(){mw.user.options.set({"ccmeonemails":0,"cols":80,"date":"default","diffonly":0,"disablemail":0,"disablesuggest":0,"editfont":"default","editondblclick":0,"editsection":0,"editsectiononrightclick":0,"enotifminoredits":0,"enotifrevealaddr":0,"enotifusertalkpages":1,"enotifwatchlistpages":0,"extendwatchlist":0,"externaldiff":0,"externaleditor":0,"fancysig":0,"forceeditsummary":0,"gender":"unknown","hideminor":0,"hidepatrolled":0,"imagesize":2,"justify":0,"math":1,"minordefault":0,"newpageshidepatrolled":0,"nocache":0,"noconvertlink":0,"norollbackdiff":0,"numberheadings":0,"previewonfirst":0,"previewontop":1,"quickbar":5,"rcdays":7,"rclimit":50,"rememberpassword":0,"rows":25,"searchlimit":20,"showhiddencats":0,"showjumplinks":1,"shownumberswatching":1,"showtoc":0,"showtoolbar":1,"skin":"cppreference2","stubthreshold":0,"thumbsize":2,"underline":2,"uselivepreview":0,"usenewrc":0,"watchcreations":0,"watchdefault":0,"watchdeletion":0,
"watchlistdays":3,"watchlisthideanons":0,"watchlisthidebots":0,"watchlisthideliu":0,"watchlisthideminor":0,"watchlisthideown":0,"watchlisthidepatrolled":0,"watchmoves":0,"wllimit":250,"variant":"zh","language":"zh","searchNs0":true,"searchNs1":false,"searchNs2":false,"searchNs3":false,"searchNs4":false,"searchNs5":false,"searchNs6":false,"searchNs7":false,"searchNs8":false,"searchNs9":false,"searchNs10":false,"searchNs11":false,"searchNs12":false,"searchNs13":false,"searchNs14":false,"searchNs15":false,"gadget-MathJax":1,"gadget-ColiruCompiler":1});;},{},{});mw.loader.implement("user.tokens",function(){mw.user.tokens.set({"editToken":"+\\","patrolToken":false,"watchToken":false});;},{},{});
/* cache key: mwiki1-mwiki_zh_:resourceloader:filter:minify-js:7:258d7cd6aa9aa67dee25e01fb6a9e505 */
}</script>
<script>if(window.mw){
mw.loader.load(["mediawiki.page.startup","mediawiki.legacy.wikibits","mediawiki.legacy.ajax"]);
}</script>
<style type="text/css">/*<![CDATA[*/
.source-cpp {line-height: normal;}
.source-cpp li, .source-cpp pre {
	line-height: normal; border: 0px none white;
}
/**
 * GeSHi Dynamically Generated Stylesheet
 * --------------------------------------
 * Dynamically generated stylesheet for cpp
 * CSS class: source-cpp, CSS id: 
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 * --------------------------------------
 */
.cpp.source-cpp .de1, .cpp.source-cpp .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;}
.cpp.source-cpp  {font-family:monospace;}
.cpp.source-cpp .imp {font-weight: bold; color: red;}
.cpp.source-cpp li, .cpp.source-cpp .li1 {font-weight: normal; vertical-align:top;}
.cpp.source-cpp .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}
.cpp.source-cpp .li2 {font-weight: bold; vertical-align:top;}
.cpp.source-cpp .kw1 {color: #0000dd;}
.cpp.source-cpp .kw2 {color: #0000ff;}
.cpp.source-cpp .kw3 {color: #0000dd;}
.cpp.source-cpp .kw4 {color: #0000ff;}
.cpp.source-cpp .co1 {color: #909090;}
.cpp.source-cpp .co2 {color: #339900;}
.cpp.source-cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp.source-cpp .es0 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es1 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es2 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es3 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es4 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es5 {color: #008000; font-weight: bold;}
.cpp.source-cpp .br0 {color: #008000;}
.cpp.source-cpp .sy0 {color: #008000;}
.cpp.source-cpp .sy1 {color: #000080;}
.cpp.source-cpp .sy2 {color: #000040;}
.cpp.source-cpp .sy3 {color: #000040;}
.cpp.source-cpp .sy4 {color: #008080;}
.cpp.source-cpp .st0 {color: #008000;}
.cpp.source-cpp .nu0 {color: #000080;}
.cpp.source-cpp .nu6 {color: #000080;}
.cpp.source-cpp .nu8 {color: #000080;}
.cpp.source-cpp .nu12 {color: #000080;}
.cpp.source-cpp .nu16 {color:#000080;}
.cpp.source-cpp .nu17 {color:#000080;}
.cpp.source-cpp .nu18 {color:#000080;}
.cpp.source-cpp .nu19 {color:#000080;}
.cpp.source-cpp .ln-xtra, .cpp.source-cpp li.ln-xtra, .cpp.source-cpp div.ln-xtra {background-color: #ffc;}
.cpp.source-cpp span.xtra { display:block; }

/*]]>*/
</style><!--[if lt IE 7]><style type="text/css">body{behavior:url("/mwiki/skins/cppreference2/csshover.min.htc")}</style><![endif]--></head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-cpp_io_basic_filebuf skin-cppreference2 action-view cpp-navbar">
        <!-- header -->
        <!-- /header -->
        <!-- content -->
<div id="cpp-content-base">
            <div id="content">
                <a id="top"></a>
                <div id="mw-js-message" style="display:none;"></div>
                                <!-- firstHeading -->
<h1 id="firstHeading" class="firstHeading"><span style="font-size:0.7em; line-height:130%">std::</span>basic_filebuf</h1>
                <!-- /firstHeading -->
                <!-- bodyContent -->
                <div id="bodyContent">
                                        <!-- tagline -->
                    <div id="siteSub">来自cppreference.com</div>
                    <!-- /tagline -->
                                        <!-- subtitle -->
                    <div id="contentSub"><span class="subpages">&lt; <a href="../../cpp.html" title="cpp">cpp</a>‎ | <a href="../io.html" title="cpp/io">io</a></span></div>
                    <!-- /subtitle -->
                                                            <!-- bodycontent -->
                    <div id="mw-content-text" lang="zh" dir="ltr" class="mw-content-ltr"><div class="t-navbar" style=""><div class="t-navbar-sep"> </div><div class="t-navbar-head"><a href="../../cpp.html" title="cpp"> C++</a><div class="t-navbar-menu"><div><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em;">
<tr class="t-nv"><td colspan="5"> <a href="../language.html" title="cpp/language">语言</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../header.html" title="cpp/header">标准库头文件</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../freestanding.html" title="cpp/freestanding"> 自立与有宿主实现</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../named_req.html" title="cpp/named req">具名要求</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../utility.html#.E8.AF.AD.E8.A8.80.E6.94.AF.E6.8C.81" title="cpp/utility">语言支持库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../concepts.html" title="cpp/concepts">概念库</a> <span class="t-mark-rev t-since-cxx20">(C++20)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../error.html" title="cpp/error">诊断库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../utility.html" title="cpp/utility">工具库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../string.html" title="cpp/string">字符串库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="https://zh.cppreference.com/w/cpp/container" title="cpp/container">容器库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../iterator.html" title="cpp/iterator">迭代器库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../ranges.html" title="cpp/ranges"> 范围库</a> <span class="t-mark-rev t-since-cxx20">(C++20)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../algorithm.html" title="cpp/algorithm">算法库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../numeric.html" title="cpp/numeric">数值库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../io.html" title="cpp/io">输入/输出库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../locale.html" title="cpp/locale">本地化库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../regex.html" title="cpp/regex">正则表达式库</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../atomic.html" title="cpp/atomic">原子操作库</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../thread.html" title="cpp/thread">线程支持库</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../filesystem.html" title="cpp/filesystem">文件系统库</a> <span class="t-mark-rev t-since-cxx17">(C++17)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../experimental.html" title="cpp/experimental">技术规范</a> </td></tr>
</table></div><div></div></div></div></div><div class="t-navbar-sep"> </div><div class="t-navbar-head"><a href="../io.html" title="cpp/io">输入/输出库</a><div class="t-navbar-menu"><div><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"> <a href="manip.html" title="cpp/io/manip"> I/O 操纵符</a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="c.html" title="cpp/io/c"> C 风格 I/O</a></td></tr>
<tr class="t-nv-h1"><td colspan="5"> 缓冲 </td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_streambuf.html" title="cpp/io/basic streambuf"><span class="t-lines"><span>basic_streambuf</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><strong class="selflink"><span class="t-lines"><span>basic_filebuf</span></span></strong></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_stringbuf.html" title="cpp/io/basic stringbuf"><span class="t-lines"><span>basic_stringbuf</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="strstreambuf.html" title="cpp/io/strstreambuf"><span class="t-lines"><span>strstreambuf</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-deprecated-cxx98">(C++98 中弃用)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_syncbuf.html" title="cpp/io/basic syncbuf"><span class="t-lines"><span>basic_syncbuf</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv-h1"><td colspan="5"> 流 </td></tr>
<tr class="t-nv-h2"><td colspan="5"> 抽象 </td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="ios_base.html" title="cpp/io/ios base"><span class="t-lines"><span>ios_base</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_ios.html" title="cpp/io/basic ios"><span class="t-lines"><span>basic_ios</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_istream.html" title="cpp/io/basic istream"><span class="t-lines"><span>basic_istream</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_ostream.html" title="cpp/io/basic ostream"><span class="t-lines"><span>basic_ostream</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_iostream.html" title="cpp/io/basic iostream"><span class="t-lines"><span>basic_iostream</span></span></a></div></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 文件 I/O </td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_ifstream.html" title="cpp/io/basic ifstream"><span class="t-lines"><span>basic_ifstream</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_ofstream.html" title="cpp/io/basic ofstream"><span class="t-lines"><span>basic_ofstream</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_fstream.html" title="cpp/io/basic fstream"><span class="t-lines"><span>basic_fstream</span></span></a></div></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 字符串 I/O </td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_istringstream.html" title="cpp/io/basic istringstream"><span class="t-lines"><span>basic_istringstream</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_ostringstream.html" title="cpp/io/basic ostringstream"><span class="t-lines"><span>basic_ostringstream</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_stringstream.html" title="cpp/io/basic stringstream"><span class="t-lines"><span>basic_stringstream</span></span></a></div></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 数组 I/O </td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="istrstream.html" title="cpp/io/istrstream"><span class="t-lines"><span>istrstream</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-deprecated-cxx98">(C++98 中弃用)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="ostrstream.html" title="cpp/io/ostrstream"><span class="t-lines"><span>ostrstream</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-deprecated-cxx98">(C++98 中弃用)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="strstream.html" title="cpp/io/strstream"><span class="t-lines"><span>strstream</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-deprecated-cxx98">(C++98 中弃用)</span></span></span></div></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 同步的输出</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_osyncstream.html" title="cpp/io/basic osyncstream"><span class="t-lines"><span>basic_osyncstream</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv-h1"><td colspan="5"> 类型 </td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="streamoff.html" title="cpp/io/streamoff"><span class="t-lines"><span>streamoff</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="streamsize.html" title="cpp/io/streamsize"><span class="t-lines"><span>streamsize</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="fpos.html" title="cpp/io/fpos"><span class="t-lines"><span>fpos</span></span></a></div></div></td></tr>
<tr class="t-nv-h1"><td colspan="5"> 错误类别接口 </td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="iostream_category.html" title="cpp/io/iostream category"><span class="t-lines"><span>iostream_category</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="io_errc.html" title="cpp/io/io errc"><span class="t-lines"><span>io_errc</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
</table></div><div></div></div></div></div><div class="t-navbar-sep"> </div><div class="t-navbar-head"><strong class="selflink"><tt>std::basic_filebuf</tt></strong><div class="t-navbar-menu"><div><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv-h1"><td colspan="5">公开成员函数</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/basic_filebuf.html" title="cpp/io/basic filebuf/basic filebuf"><span class="t-lines"><span>basic_filebuf::basic_filebuf</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/~basic_filebuf.html" title="cpp/io/basic filebuf/~basic filebuf"><span class="t-lines"><span>basic_filebuf::~basic_filebuf</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/operator%3D.html" title="cpp/io/basic filebuf/operator="><span class="t-lines"><span>basic_filebuf::operator=</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/swap.html" title="cpp/io/basic filebuf/swap"><span class="t-lines"><span>basic_filebuf::swap</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/is_open.html" title="cpp/io/basic filebuf/is open"><span class="t-lines"><span>basic_filebuf::is_open</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/open.html" title="cpp/io/basic filebuf/open"><span class="t-lines"><span>basic_filebuf::open</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/close.html" title="cpp/io/basic filebuf/close"><span class="t-lines"><span>basic_filebuf::close</span></span></a></div></div></td></tr>
<tr class="t-nv-h1"><td colspan="5">受保护成员函数</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/showmanyc.html" title="cpp/io/basic filebuf/showmanyc"><span class="t-lines"><span>basic_filebuf::showmanyc</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/underflow.html" title="cpp/io/basic filebuf/underflow"><span class="t-lines"><span>basic_filebuf::underflow</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/uflow.html" title="cpp/io/basic filebuf/uflow"><span class="t-lines"><span>basic_filebuf::uflow</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/pbackfail.html" title="cpp/io/basic filebuf/pbackfail"><span class="t-lines"><span>basic_filebuf::pbackfail</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/overflow.html" title="cpp/io/basic filebuf/overflow"><span class="t-lines"><span>basic_filebuf::overflow</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/setbuf.html" title="cpp/io/basic filebuf/setbuf"><span class="t-lines"><span>basic_filebuf::setbuf</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/seekoff.html" title="cpp/io/basic filebuf/seekoff"><span class="t-lines"><span>basic_filebuf::seekoff</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/seekpos.html" title="cpp/io/basic filebuf/seekpos"><span class="t-lines"><span>basic_filebuf::seekpos</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/sync.html" title="cpp/io/basic filebuf/sync"><span class="t-lines"><span>basic_filebuf::sync</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/imbue.html" title="cpp/io/basic filebuf/imbue"><span class="t-lines"><span>basic_filebuf::imbue</span></span></a></div></div></td></tr>
<tr class="t-nv-h1"><td colspan="5">非成员函数</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_filebuf/swap2.html" title="cpp/io/basic filebuf/swap2"><span class="t-lines"><span>swap<span class="t-dsc-small">(std::basic_filebuf)</span></span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
</table></div><div></div></div></div></div><div class="t-navbar-sep"> </div></div>
<table class="t-dcl-begin"><tbody>
<tr class="t-dsc-header">
<td> <div>定义于头文件 <code><a href="../header/fstream.html" title="cpp/header/fstream">&lt;fstream&gt;</a></code>
 </div></td>
<td></td>
<td></td>
</tr>
<tr class="t-dcl">
<td class="t-dcl-nopad"> <div><span class="mw-geshi cpp source-cpp"><span class="kw1">template</span><span class="sy1">&lt;</span> <br>
<p>    <span class="kw1">class</span> CharT, <br>
    <span class="kw1">class</span> Traits <span class="sy1">=</span> <a href="../string/char_traits.html"><span class="kw1267">std::<span class="me2">char_traits</span></span></a><span class="sy1">&lt;</span>CharT<span class="sy1">&gt;</span><br>
</p>
<span class="sy1">&gt;</span> <span class="kw1">class</span> basic_filebuf <span class="sy4">:</span> <span class="kw1">public</span> <a href="basic_streambuf.html"><span class="kw1666">std::<span class="me2">basic_streambuf</span></span></a><span class="sy1">&lt;</span>CharT, Traits<span class="sy1">&gt;</span></span></div></td>
<td class="t-dcl-nopad">  </td>
<td class="t-dcl-nopad">  </td>
</tr>
<tr class="t-dcl-sep"><td></td><td></td><td></td></tr>
</tbody></table>
<p><code>std::basic_filebuf</code> 是关联字符序列为文件的 <span class="t-lc"><a href="basic_streambuf.html" title="cpp/io/basic streambuf">std::basic_streambuf</a></span> 。输入序列和输出序列都关联到同一文件，并为两种操作维护连接文件位置。
</p><p>函数 underflow() 和 overflow()/sync() 进行文件和缓冲区的获取放置区之间的实际 I/O 。 <code>CharT</code> 不是 <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">char</span></span></span> 时，多数实现在文件存储多字节字符，并用 <span class="t-lc"><a href="../locale/codecvt.html" title="cpp/locale/codecvt">std::codecvt</a></span> 平面进行宽/多字节字符转换。
</p><p>亦为常用字符类型定义二个特化：
</p>
<table class="t-dsc-begin">

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于头文件 <code>&lt;streambuf&gt;</code> </div>
</td></tr>

<tr class="t-dsc-sep">
<td colspan="2">  
</td></tr>
<tr class="t-dsc-hitem">
<td> 类型
</td>
<td> 定义
</td></tr>


<tr class="t-dsc">
<td>  <code>filebuf</code>
</td>
<td>  <span class="t-c"><span class="mw-geshi cpp source-cpp">basic_filebuf<span class="sy1">&lt;</span><span class="kw4">char</span><span class="sy1">&gt;</span></span></span>
</td></tr>

<tr class="t-dsc">
<td>  <code>wfilebuf</code>
</td>
<td>  <span class="t-c"><span class="mw-geshi cpp source-cpp">basic_filebuf<span class="sy1">&lt;</span><span class="kw4">wchar_t</span><span class="sy1">&gt;</span></span></span>
</td></tr>
</table>
<h3><span class="mw-headline" id=".E6.88.90.E5.91.98.E7.B1.BB.E5.9E.8B">成员类型</span></h3>
<table class="t-dsc-begin">

<tr class="t-dsc-sep">
<td colspan="2">  
</td></tr>
<tr class="t-dsc-hitem">
<td> 定义类型
</td>
<td> 定义
</td></tr>


<tr class="t-dsc">
<td>  <code>char_type</code>
</td>
<td>  <span class="t-c"><span class="mw-geshi cpp source-cpp">CharT</span></span></td></tr>

<tr class="t-dsc">
<td>  <code>traits_type</code>
</td>
<td>  <span class="t-c"><span class="mw-geshi cpp source-cpp">Traits</span></span> ；若 <code>Traits::char_type</code> 不是 <code>CharT</code> 则程序为谬构。</td></tr>

<tr class="t-dsc">
<td>  <code>int_type</code>
</td>
<td>  <span class="t-c"><span class="mw-geshi cpp source-cpp">Traits<span class="sy4">::</span><span class="me2">int_type</span></span></span></td></tr>

<tr class="t-dsc">
<td>  <code>pos_type</code>
</td>
<td> 要求为 <span class="t-c"><span class="mw-geshi cpp source-cpp"><a href="fpos.html"><span class="kw1802">std::<span class="me2">fpos</span></span></a><span class="sy1">&lt;</span>Traits<span class="sy4">::</span><span class="me2">state_type</span><span class="sy1">&gt;</span></span></span> 的 <span class="t-c"><span class="mw-geshi cpp source-cpp">Traits<span class="sy4">::</span><span class="me2">pos_type</span></span></span>
</td></tr>

<tr class="t-dsc">
<td>  <code>off_type</code>
</td>
<td>  <span class="t-c"><span class="mw-geshi cpp source-cpp">Traits<span class="sy4">::</span><span class="me2">off_type</span></span></span></td></tr>
</table>
<h3><span class="mw-headline" id=".E6.88.90.E5.91.98.E5.87.BD.E6.95.B0">成员函数</span></h3>
<table class="t-dsc-begin">

<tr>
<td colspan="2"> <h3> <span class="mw-headline" id=".E5.85.AC.E5.BC.80.E6.88.90.E5.91.98.E5.87.BD.E6.95.B0">公开成员函数</span></h3>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div t-dsc-member-nobold-div"><div><a href="basic_filebuf/basic_filebuf.html" title="cpp/io/basic filebuf/basic filebuf"> <span class="t-lines"><span>(构造函数)</span></span></a></div></div>
</td>
<td>  构造 basic_filebuf 对象 <br> <span class="t-mark">(公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/operator%3D.html" title="cpp/io/basic filebuf/operator="> <span class="t-lines"><span>operator=</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>  赋值 basic_filebuf 对象 <br> <span class="t-mark">(公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/swap.html" title="cpp/io/basic filebuf/swap"> <span class="t-lines"><span>swap</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>  交换二个 basic_filebuf 对象 <br> <span class="t-mark">(公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div t-dsc-member-nobold-div"><div><a href="basic_filebuf/~basic_filebuf.html" title="cpp/io/basic filebuf/~basic filebuf"> <span class="t-lines"><span>(析构函数)</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  析构 basic_filebuf 对象并且若打开则关闭文件 <br> <span class="t-mark">(虚公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/is_open.html" title="cpp/io/basic filebuf/is open"> <span class="t-lines"><span>is_open</span></span></a></div></div>
</td>
<td>  检查关联文件是否打开 <br> <span class="t-mark">(公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/open.html" title="cpp/io/basic filebuf/open"> <span class="t-lines"><span>open</span></span></a></div></div>
</td>
<td>  打开文件并配置它为关联字符序列 <br> <span class="t-mark">(公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/close.html" title="cpp/io/basic filebuf/close"> <span class="t-lines"><span>close</span></span></a></div></div>
</td>
<td>  冲入放置区缓冲区并关闭关联的文件 <br> <span class="t-mark">(公开成员函数)</span> </td></tr>

<tr>
<td colspan="2"> <h3> <span class="mw-headline" id=".E5.8F.97.E4.BF.9D.E6.8A.A4.E6.88.90.E5.91.98.E5.87.BD.E6.95.B0">受保护成员函数</span></h3>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/showmanyc.html" title="cpp/io/basic filebuf/showmanyc"> <span class="t-lines"><span>showmanyc</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  可选地提供可用于从文件输入的字符数 <br> <span class="t-mark">(虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/underflow.html" title="cpp/io/basic filebuf/underflow"> <span class="t-lines"><span>underflow</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  从关联文件读取 <br> <span class="t-mark">(虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/uflow.html" title="cpp/io/basic filebuf/uflow"> <span class="t-lines"><span>uflow</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  从关联文件读取，并令获取区的下一位置指针前进 <br> <span class="t-mark">(虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/pbackfail.html" title="cpp/io/basic filebuf/pbackfail"> <span class="t-lines"><span>pbackfail</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  回退输出序列以放回字符，不影响关联文件 <br> <span class="t-mark">(虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/overflow.html" title="cpp/io/basic filebuf/overflow"> <span class="t-lines"><span>overflow</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  从放置区写字符到关联的文件 <br> <span class="t-mark">(虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/setbuf.html" title="cpp/io/basic filebuf/setbuf"> <span class="t-lines"><span>setbuf</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  提供用户供应的缓冲区，或将此 filebuf 转变为无缓冲 <br> <span class="t-mark">(虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/seekoff.html" title="cpp/io/basic filebuf/seekoff"> <span class="t-lines"><span>seekoff</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  用相对寻址重寻位文件位置 <br> <span class="t-mark">(虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/seekpos.html" title="cpp/io/basic filebuf/seekpos"> <span class="t-lines"><span>seekpos</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  用绝对寻址重寻位文件位置 <br> <span class="t-mark">(虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/sync.html" title="cpp/io/basic filebuf/sync"> <span class="t-lines"><span>sync</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  从放置区写字符到关联文件 <br> <span class="t-mark">(虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/imbue.html" title="cpp/io/basic filebuf/imbue"> <span class="t-lines"><span>imbue</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  更改关联的本地环境 <br> <span class="t-mark">(虚受保护成员函数)</span> </td></tr>
</table>
<h3><span class="mw-headline" id=".E9.9D.9E.E6.88.90.E5.91.98.E5.87.BD.E6.95.B0">非成员函数</span></h3>
<table class="t-dsc-begin">

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_filebuf/swap2.html" title="cpp/io/basic filebuf/swap2"> <span class="t-lines"><span>std::swap<span class="t-dsc-small">(std::basic_filebuf)</span></span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   特化 <span class="t-lc"><a href="../algorithm/swap.html" title="cpp/algorithm/swap">std::swap</a></span> 算法 <br> <span class="t-mark">(函数模板)</span> </td></tr>
</table>
<div class="t-inherited">
<h2> <span class="mw-headline" id=".E7.BB.A7.E6.89.BF.E8.87.AA_std::basic_streambuf">继承自  <a href="basic_streambuf.html" title="cpp/io/basic streambuf"> <span style="font-size:0.7em; line-height:130%">std::</span>basic_streambuf</a> </span></h2>
<h3> <span class="mw-headline" id=".E6.88.90.E5.91.98.E7.B1.BB.E5.9E.8B_2">成员类型</span></h3>
<table class="t-dsc-begin">

<tr class="t-dsc-sep">
<td colspan="2">  
</td></tr>
<tr class="t-dsc-hitem">
<td> 成员类型
</td>
<td> 定义
</td></tr>


<tr class="t-dsc">
<td>  <code>char_type</code>
</td>
<td>  <span class="t-c"><span class="mw-geshi cpp source-cpp">CharT</span></span></td></tr>

<tr class="t-dsc">
<td>  <code>traits_type</code>
</td>
<td>  <span class="t-c"><span class="mw-geshi cpp source-cpp">Traits</span></span> ；若 <code>Traits::char_type</code> 不是 <code>CharT</code> 则程序为谬构。</td></tr>

<tr class="t-dsc">
<td>  <code>int_type</code>
</td>
<td>  <span class="t-c"><span class="mw-geshi cpp source-cpp">Traits<span class="sy4">::</span><span class="me2">int_type</span></span></span></td></tr>

<tr class="t-dsc">
<td>  <code>pos_type</code>
</td>
<td>  <span class="t-c"><span class="mw-geshi cpp source-cpp">Traits<span class="sy4">::</span><span class="me2">pos_type</span></span></span></td></tr>

<tr class="t-dsc">
<td>  <code>off_type</code>
</td>
<td>  <span class="t-c"><span class="mw-geshi cpp source-cpp">Traits<span class="sy4">::</span><span class="me2">off_type</span></span></span></td></tr>
</table>
<h3> <span class="mw-headline" id=".E6.88.90.E5.91.98.E5.87.BD.E6.95.B0_2">成员函数</span></h3>
<table class="t-dsc-begin">

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div t-dsc-member-nobold-div"><div><a href="basic_streambuf/~basic_streambuf.html" title="cpp/io/basic streambuf/~basic streambuf"> <span class="t-lines"><span>(析构函数)</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  析构 basic_streambuf 对象 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的虚公开成员函数)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E6.9C.AC.E5.9C.B0.E7.8E.AF.E5.A2.83"> 本地环境 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/pubimbue.html" title="cpp/io/basic streambuf/pubimbue"> <span class="t-lines"><span>pubimbue</span></span></a></div></div>
</td>
<td>  调用 <span class="t-c"><span class="mw-geshi cpp source-cpp">imbue<span class="br0">(</span><span class="br0">)</span></span></span> <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/getloc.html" title="cpp/io/basic streambuf/getloc"> <span class="t-lines"><span>getloc</span></span></a></div></div>
</td>
<td>  获得相关本地环境的副本 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E5.AF.BB.E4.BD.8D"> 寻位 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/pubsetbuf.html" title="cpp/io/basic streambuf/pubsetbuf"> <span class="t-lines"><span>pubsetbuf</span></span></a></div></div>
</td>
<td>  调用 <span class="t-c"><span class="mw-geshi cpp source-cpp">setbuf<span class="br0">(</span><span class="br0">)</span></span></span> <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/pubseekoff.html" title="cpp/io/basic streambuf/pubseekoff"> <span class="t-lines"><span>pubseekoff</span></span></a></div></div>
</td>
<td>  调用 <span class="t-c"><span class="mw-geshi cpp source-cpp">seekoff<span class="br0">(</span><span class="br0">)</span></span></span> <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/pubseekpos.html" title="cpp/io/basic streambuf/pubseekpos"> <span class="t-lines"><span>pubseekpos</span></span></a></div></div>
</td>
<td>  调用 <span class="t-c"><span class="mw-geshi cpp source-cpp">seekpos<span class="br0">(</span><span class="br0">)</span></span></span> <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/pubsync.html" title="cpp/io/basic streambuf/pubsync"> <span class="t-lines"><span>pubsync</span></span></a></div></div>
</td>
<td>  调用 <span class="t-c"><span class="mw-geshi cpp source-cpp">sync<span class="br0">(</span><span class="br0">)</span></span></span> <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E8.8E.B7.E5.8F.96.E5.8C.BA"> 获取区 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/in_avail.html" title="cpp/io/basic streambuf/in avail"> <span class="t-lines"><span>in_avail</span></span></a></div></div>
</td>
<td>  获得获取区中立即可用的字符数 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/snextc.html" title="cpp/io/basic streambuf/snextc"> <span class="t-lines"><span>snextc</span></span></a></div></div>
</td>
<td>  令输入序列前进，读取一个字符而不再次前进 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/sbumpc.html" title="cpp/io/basic streambuf/sbumpc"> <span class="t-lines"><span>sbumpc</span></span></a></div></div>
</td>
<td>  从输入序列读取一个字符并令序列前进 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><span class="t-lines"><span>stossc</span></span></div><div><span class="t-lines"><span><span class="t-mark-rev t-deprecated-cxx98">(C++98 中弃用)</span></span><span><span class="t-mark-rev t-until-cxx17">(C++17 中移除)</span></span></span></div></div>
</td>
<td>  令输入序列前进，如同通过调用 <span class="t-lc"><a href="basic_streambuf/sbumpc.html" title="cpp/io/basic streambuf/sbumpc">sbumpc()</a></span> 并舍弃结果 <br> <span class="t-mark">(公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/sgetc.html" title="cpp/io/basic streambuf/sgetc"> <span class="t-lines"><span>sgetc</span></span></a></div></div>
</td>
<td>  从输入序列读取一个字符，而不令序列前进 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/sgetn.html" title="cpp/io/basic streambuf/sgetn"> <span class="t-lines"><span>sgetn</span></span></a></div></div>
</td>
<td>  调用 <span class="t-c"><span class="mw-geshi cpp source-cpp">xsgetn<span class="br0">(</span><span class="br0">)</span></span></span>  <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E6.94.BE.E7.BD.AE.E5.8C.BA"> 放置区 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/sputc.html" title="cpp/io/basic streambuf/sputc"> <span class="t-lines"><span>sputc</span></span></a></div></div>
</td>
<td>  写一个字符到放置区域，并令 next 指针前进 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/sputn.html" title="cpp/io/basic streambuf/sputn"> <span class="t-lines"><span>sputn</span></span></a></div></div>
</td>
<td>  调用 <span class="t-c"><span class="mw-geshi cpp source-cpp">xsputn<span class="br0">(</span><span class="br0">)</span></span></span> <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E5.9B.9E.E6.94.BE"> 回放 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/sputbackc.html" title="cpp/io/basic streambuf/sputbackc"> <span class="t-lines"><span>sputbackc</span></span></a></div></div>
</td>
<td>  在输入序列中放回一个字符 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/sungetc.html" title="cpp/io/basic streambuf/sungetc"> <span class="t-lines"><span>sungetc</span></span></a></div></div>
</td>
<td>  回移一位输出序列中的下一位置指针 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的公开成员函数)</span> </td></tr>
</table>
<h3> <span class="mw-headline" id=".E5.8F.97.E4.BF.9D.E6.8A.A4.E6.88.90.E5.91.98.E5.87.BD.E6.95.B0_2">受保护成员函数</span></h3>
<table class="t-dsc-begin">

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div t-dsc-member-nobold-div"><div><a href="basic_streambuf/basic_streambuf.html" title="cpp/io/basic streambuf/basic streambuf"> <span class="t-lines"><span>(构造函数)</span></span></a></div></div>
</td>
<td>  构造 basic_streambuf 对象 <br> <span class="t-mark">(受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/operator%3D.html" title="cpp/io/basic streambuf/operator="> <span class="t-lines"><span>operator=</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>  替换 basic_streambuf 对象 <br> <span class="t-mark">(受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/swap.html" title="cpp/io/basic streambuf/swap"> <span class="t-lines"><span>swap</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>  交换二个 basic_streambuf 对象 <br> <span class="t-mark">(受保护成员函数)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E6.9C.AC.E5.9C.B0.E7.8E.AF.E5.A2.83_2"> 本地环境 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/pubimbue.html" title="cpp/io/basic streambuf/pubimbue"> <span class="t-lines"><span>imbue</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  更改关联的本地环境 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的虚受保护成员函数)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E5.AF.BB.E4.BD.8D_2"> 寻位 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/pubsetbuf.html" title="cpp/io/basic streambuf/pubsetbuf"> <span class="t-lines"><span>setbuf</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  若容许则以用户定义数组替换缓冲区 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/pubseekoff.html" title="cpp/io/basic streambuf/pubseekoff"> <span class="t-lines"><span>seekoff</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  用相对寻址重定位输入序列、输出序列或两者中的下一位置指针 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/pubseekpos.html" title="cpp/io/basic streambuf/pubseekpos"> <span class="t-lines"><span>seekpos</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  用绝对寻址重定位输入序列、输出序列或两者中的下一位置指针 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/pubsync.html" title="cpp/io/basic streambuf/pubsync"> <span class="t-lines"><span>sync</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  将缓冲与关联的字符序列同步 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的虚受保护成员函数)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E8.8E.B7.E5.8F.96.E5.8C.BA_2"> 获取区 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/showmanyc.html" title="cpp/io/basic streambuf/showmanyc"> <span class="t-lines"><span>showmanyc</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  若已知，则获得关联输入序列中可用于输入的字符数 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/underflow.html" title="cpp/io/basic streambuf/underflow"> <span class="t-lines"><span>underflow</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  从关联输入序列读取字符到获取区 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/uflow.html" title="cpp/io/basic streambuf/uflow"> <span class="t-lines"><span>uflow</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  从输入序列读取字符到获取区，并令下一位置指针前进 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/sgetn.html" title="cpp/io/basic streambuf/sgetn"> <span class="t-lines"><span>xsgetn</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  从输入序列读取多个字符 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/gptr.html" title="cpp/io/basic streambuf/gptr"> <span class="t-lines"><span>eback</span><span>gptr</span><span>egptr</span></span></a></div></div>
</td>
<td>  返回指向获取区起始、当前字符和末尾的指针 <br> <span class="t-mark">(受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/gbump.html" title="cpp/io/basic streambuf/gbump"> <span class="t-lines"><span>gbump</span></span></a></div></div>
</td>
<td>  令输出序列中的下一位置指针前进 <br> <span class="t-mark">(受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/setg.html" title="cpp/io/basic streambuf/setg"> <span class="t-lines"><span>setg</span></span></a></div></div>
</td>
<td>  重定位输出序列的起始、下一位置和终止指针 <br> <span class="t-mark">(受保护成员函数)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E6.94.BE.E7.BD.AE.E5.8C.BA_2"> 放置区 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/sputn.html" title="cpp/io/basic streambuf/sputn"> <span class="t-lines"><span>xsputn</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  将多个字符写到输出序列 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/overflow.html" title="cpp/io/basic streambuf/overflow"> <span class="t-lines"><span>overflow</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  从放置区写入字符到关联的输出序列 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的虚受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/pptr.html" title="cpp/io/basic streambuf/pptr"> <span class="t-lines"><span>pbase</span><span>pptr</span><span>epptr</span></span></a></div></div>
</td>
<td>  返回指向放置区的起始、当前字符和末尾的指针 <br> <span class="t-mark">(受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/pbump.html" title="cpp/io/basic streambuf/pbump"> <span class="t-lines"><span>pbump</span></span></a></div></div>
</td>
<td>  令输出序列中的下一位置指针前进 <br> <span class="t-mark">(受保护成员函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/setp.html" title="cpp/io/basic streambuf/setp"> <span class="t-lines"><span>setp</span></span></a></div></div>
</td>
<td>  重定位输出序列的起始、下一位置和终止指针 <br> <span class="t-mark">(受保护成员函数)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E5.9B.9E.E6.94.BE_2"> 回放 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="basic_streambuf/pbackfail.html" title="cpp/io/basic streambuf/pbackfail"> <span class="t-lines"><span>pbackfail</span></span></a></div><div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div></div>
</td>
<td>  将字符放回输入序列，可能修改输入序列 <br> <span class="t-mark">(<code>std::basic_streambuf&lt;CharT,Traits&gt;</code> 的虚受保护成员函数)</span> </td></tr>
</table>
</div>

<!-- 
NewPP limit report
Preprocessor visited node count: 14831/1000000
Preprocessor generated node count: 13518/1000000
Post‐expand include size: 469462/2097152 bytes
Template argument size: 110927/2097152 bytes
Highest expansion depth: 35/40
Expensive parser function count: 0/100
-->

<!-- Saved in parser cache with key mwiki1-mwiki_zh_:pcache:idhash:2188-0!*!0!!zh!*!zh!* and timestamp 20200211040426 -->
</div>                    <!-- /bodycontent -->
                                        <!-- printfooter -->
                    <div class="printfooter">
                    来自“<a href="https://zh.cppreference.com/mwiki/index.php?title=cpp/io/basic_filebuf&amp;oldid=46607">https://zh.cppreference.com/mwiki/index.php?title=cpp/io/basic_filebuf&amp;oldid=46607</a>”                    </div>
                    <!-- /printfooter -->
                                                            <!-- catlinks -->
                    <!-- /catlinks -->
                                                            <div class="visualClear"></div>
                    <!-- debughtml -->
                                        <!-- /debughtml -->
                </div>
                <!-- /bodyContent -->
            </div>
        </div>
        <!-- /content -->
        <!-- footer -->
        <div id="cpp-footer-base" class="noprint">
            <div id="footer">
                        <div id="cpp-navigation">
            <h5>导航</h5>
            <ul><li><a href="https://zh.cppreference.com/w/cpp/io/basic_filebuf">Online version</a></li><li>Offline version retrieved 2020-03-14 18:00.</li></ul></div>
                        <ul id="footer-info">
                                    <li id="footer-info-lastmod"> 本页面最后修改于2017年9月15日 (星期五) 17:26。</li>
                                    <li id="footer-info-viewcount">此页面已被浏览过9,385次。</li>
                            </ul>
                    </div>
        </div>
        <!-- /footer -->
        <script>if(window.mw){
mw.loader.state({"site":"loading","user":"missing","user.groups":"ready"});
}</script>
<script src="../../../common/skin_scripts.js"></script>
<script>if(window.mw){
mw.loader.load(["mediawiki.action.view.postEdit","mediawiki.user","mediawiki.page.ready","mediawiki.searchSuggest","mediawiki.hidpi","ext.gadget.MathJax","ext.gadget.ColiruCompiler"], null, true);
}</script>
<script src="../../../common/site_scripts.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2828341-1']);
_gaq.push(['_setDomainName', 'cppreference.com']);
_gaq.push(['_trackPageview']);
</script><!-- Served in 2.284 secs. -->
	</body>
<!-- Cached 20200211040426 -->
</html>